import api from "../../api/index"
import Dialog from 'tdesign-miniprogram/dialog/index';

Page({
  data: {
    swiperList: ['/assets/images/common/banner.png', '/assets/images/common/banner.png', '/assets/images/common/banner.png'],
    activityList: [
      { icon: '/assets/images/common/icon-activity1.png', title: '新闻中心', url: '/pages/news-list/news-list' },
      { icon: '/assets/images/common/icon-activity2.png', title: '学习概括', url: '/pages/contact-us/contact-us' },
      { icon: '/assets/images/common/icon-activity3.png', title: '校友风采', url: '/pages/alumni-list/alumni-list' },
      { icon: '/assets/images/common/icon-activity4.png', title: '联系我们', url: '/pages/contact-us/contact-us' }
    ],
    campusStyleList: [
      [
        { icon: '/assets/images/common/icon-activity1.png', class: '86级校友', name: '姓名', id: 1 },
        { icon: '/assets/images/common/icon-activity1.png', class: '86级校友', name: '姓名', id: 2 },
        { icon: '/assets/images/common/icon-activity1.png', class: '86级校友', name: '姓名', id: 3 },
      ],
      [
        { icon: '/assets/images/common/icon-activity1.png', class: '86级校友', name: '姓名', id: 4 },
        { icon: '/assets/images/common/icon-activity1.png', class: '86级校友', name: '姓名', id: 5 },]
    ],
    campusStyleCurrent: 0,
    workList: []
  },
  onLoad(options) {
    console.log(this);
    this.getTabBar().init();
    // api.base.listByTypeCode().then(res => {
    //   console.log(res);
    //   this.setData({ workList: res })
    // })
    api.base.fellowStyle().then(res => {
      console.log(res);
      // this.
      const campusStyleList = [res.records]
      this.setData({ campusStyleList })
    })
  },
  onReady() {

  },
  onShow() {

  },
  onHide() {

  },
  onUnload() {

  },

  onShareAppMessage() {

  },
  gotoOther(e) {
    const { url } = e.currentTarget.dataset
    wx.navigateTo({
      url,
      fail() {
        wx.switchTab({ url, })
      }
    })
    console.log(e);
  },
  changeSwiper(e) {
    const { current } = e.detail
    this.setData({ campusStyleCurrent: current })
  },
  onTapBanner(e) {
    console.log(e);
  },
  gotoDetail(e) {
    const { url, id } = e.currentTarget.dataset
    console.log(`${url}?id=${id}`);
    wx.navigateTo({ url: `${url}?id=${id}` })
  },
})